package pers.vic.grow.netty.chapter_1_00.aio.server;

import pers.vic.grow.netty.chapter_1_00.aio.ChannelInitializer;

import java.nio.ByteBuffer;
import java.nio.channels.AsynchronousSocketChannel;
import java.nio.charset.Charset;
import java.util.concurrent.TimeUnit;

/**
 * @author Vic.xu
 * @description:
 * @date: 2021/9/2 0002 17:37
 */
public class AioServerChannelInitializer  extends ChannelInitializer {

    @Override
    protected void initChannel(AsynchronousSocketChannel channel) throws Exception {
        channel.read(ByteBuffer.allocate(1024), 10, TimeUnit.SECONDS, null, new AioServerHandler(channel, Charset.forName("GBK")));
    }
}
